package com.x.erp.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.erp.dao.SeriesDao;
import com.x.erp.model.Series;
import com.x.erp.rpc.SeriesRpcService;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;

@Component
@Service(interfaceName = "com.x.erp.rpc.SeriesRpcService", timeout = 60000)
public class SeriesService implements SeriesRpcService {

	@Autowired
	private SeriesDao seriesDao;

	@Override
	public List<Series> selectSeriesList(Series series) {
		try {
			return seriesDao.selectSeriesList(series);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0012, e);
		}
	}

    @Override
    public void insertSeriesList(Series series) {
        try {
            seriesDao.insertSeriesList(series);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0001, e);
        }
    }

    @Override
    public void updateSeriesList(Series series) {
        try {
            seriesDao.updateSeriesList(series);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0001, e);
        }
    }

    @Override
    public Series getSimpleSeries(Map<String, Object> series){
        try {
            return seriesDao.getSimpleSeries(series);
        } catch (Exception e) {
            throw new BusinessException(ExceptionCode.EXCEPTION_CODE0001, e);
        }
    }
}
